#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
# @FileName  :base_class.py
# @Time      :2022/4/21 12:17 AM
# @Author    :Toliong toliong@foxmail.com
# @packages  :pip install sqlalchemy psycopg2
"""

from typing import Any
from sqlalchemy.ext.declarative import as_declarative, declared_attr


@as_declarative()
class Base:
    id: Any
    __name__: str

    #to generate tablename from classname
    @declared_attr
    def __tablename__(cls) -> str:
        return cls.__name__.lower()

if __name__ == "__main__":
    pass
